package com.cats.template.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cats.template.sys.pojo.model.RoleModel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

/**
 * @author duxiaobo
 * @date 2021/9/102:35 下午
 */
@Mapper
public interface RoleMapper extends BaseMapper<RoleModel> {

    @Select("SELECT * from sys_roles where id in (" +
            "SELECT role_id from sys_users_roles where user_id=#{userId} and delete_flg =  0" +
            ") and delete_flg =  0")
    Set<RoleModel> getRoleListByUserId(@Param("userId") Long userId);
}
